<template>
  <view class="container_dialog" v-if="dialog">
    <view class="dialog">
      <view class="title">
        {{ title }}
      </view>
      <view class="content" v-if="slots">{{ content }}</view>
      <slot></slot>
      <view class="btn">
        <text class="cancelText" @click="cancel">取 消</text>
        <text class="confirmText" @click="confirm">确 认</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: '提示'
    },
    content: {
      type: String,
      default: '确认删除此订单吗'
    },
    dialog: {
      type: Boolean,
      default: false
    },
    slots: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    cancel() {
      this.$emit('cancel')
    },
    confirm() {
      this.$emit('confirm')
    }
  }
}
</script>

<style lang="scss" scoped>
.container_dialog {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9998;
  background: rgba($color: #000000, $alpha: 0.2);

  .dialog {
    width: 615rpx;
    height: 289rpx;
    background: #ffffff;
    border-radius: 11rpx;
    margin: 50% auto 0;

    .title {
      font-size: 42rpx;
      padding: 40.28rpx 0 27.08rpx;
      text-align: center;
      line-height: 1;
    }

    .content {
      font-size: 28rpx;
      color: #585858;
      // padding-bottom: 25.69rpx;
      padding-bottom: 50rpx;
      text-align: center;
      line-height: 1;
    }

    .btn {
      padding: 0 46.84rpx;
      display: flex;
      justify-content: space-between;

      text {
        display: inline-block;
        width: 236.11rpx;
        height: 57.64rpx;
        line-height: 57.64rpx;
        border-radius: 50rpx;
        text-align: center;
        font-size: 29rpx;
      }

      .cancelText {
        color: #2871fc;
        border: 1px solid #2871fc;
      }

      .confirmText {
        color: #fff;
        background: #2871fc;
      }
    }
  }
}
</style>
